package org.common.service;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 *
 * @author gus
 */
public class DependenceManager implements ApplicationContextAware
{
    private static DependenceManager instance = new DependenceManager();
    
    private ApplicationContext applicationContext;
    
    private DependenceManager()
    {
    }

    public <T> T getBean(String beanID)
    {
        return (T) applicationContext.getBean(beanID);
    }


    public static DependenceManager getInstance() throws Exception
    {
        return instance;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
    {
        this.applicationContext = applicationContext;
    }
}
